package com.zhudeshuai.zhudemolist.widget.MyScrollView;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.zhu.zhuCore.utils.LogUtil;

/**
 * 解决横向滚动冲突问题
 *
 * @author zhudeshuai
 * @since 17/12/16
 */

public class MyRecyclerView extends RecyclerView {

	private float mLastX;
	private float mLastY;

	public MyRecyclerView(Context context) {
		super(context);
	}

	public MyRecyclerView(Context context, @Nullable AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent ev) {

		switch (ev.getAction()) {
			case MotionEvent.ACTION_DOWN:
				LogUtil.d("zhu", "MyRecyclerView:ACTION_DOWN");
				break;
			case MotionEvent.ACTION_MOVE:
				LogUtil.d("zhu", "MyRecyclerView:ACTION_MOVE");
				break;
			case MotionEvent.ACTION_UP:
				LogUtil.d("zhu", "MyRecyclerView:ACTION_UP");
				break;
		}

		return super.dispatchTouchEvent(ev);
	}

	@Override
	public boolean onInterceptTouchEvent(MotionEvent e) {
		switch (e.getAction()) {
			case MotionEvent.ACTION_DOWN:
				LogUtil.d("zhu", "MyRecyclerView:onInterceptTouchEvent:ACTION_DOWN");
				break;
			case MotionEvent.ACTION_MOVE:
				LogUtil.d("zhu", "MyRecyclerView:onInterceptTouchEvent:ACTION_MOVE");
				break;
			case MotionEvent.ACTION_UP:
				LogUtil.d("zhu", "MyRecyclerView:onInterceptTouchEvent:ACTION_UP");
				break;
		}

		return super.onInterceptTouchEvent(e);
	}
}
